package ca.cbc.giscommon.entity;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "event_subcategory")
public class EventSubcategory implements Cloneable, Serializable {
    private static final long serialVersionUID = 3880555058055004284L;
	private long id;
	private String subcategory;
	private String feedCategories;

	public EventSubcategory() {}
	
	public EventSubcategory(String subcategory, String feedCategories) {
		this.setSubcategory(subcategory);
		this.setFeedCategories(feedCategories);
	}
	
	@Override
	public EventSubcategory clone() throws CloneNotSupportedException {
		return (EventSubcategory) super.clone();
	}

	public boolean equals(Object obj) {
		if(obj.getClass().equals(EventSubcategory.class) && ((EventSubcategory)obj).getId() == this.getId()) {
			return true;
		}
		return false;
	}
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	public long getId() {
		return id;
	}
	
	@Column(name = "feed_categories")
	public String getFeedCategories() {
		return feedCategories;
	}
	
	public String getSubcategory() {
		return subcategory;
	}

	public void setId(long id) {
		this.id = id;
	}

	public void setFeedCategories(String feedCategories) {
		this.feedCategories = feedCategories;
	}
	
	public void setSubcategory(String subcategory) {
		this.subcategory = subcategory;
	}
	
	public String toString() {
		return new StringBuffer("EventType {id:").append(id)
					.append(", subcategory:").append(subcategory)
					.append(", feedCategories:").append(feedCategories)
					.append("}")
					.toString();
	}
}
